Utils.Chrome = {};
Utils.Chrome.contextMenu = {};
Utils.Chrome.i18n = {};
Utils.Chrome.i18n.get = function(string, subs)
{
    return chrome.i18n.getMessage(string, subs);
}

Utils.Chrome.i18n.addLang = function(lang)
{
    chrome.i18n.appendAcceptLanguage(lang);
}

Utils.Chrome.infoBar = {};
Utils.Chrome.infoBar.show = function(url, callback)
{
    if(chrome.experimental.infobars instanceof Object)
    {
        var callback = callback instanceof Function  ? callback :
        function(w)
        {
            console.log(w);
        };
        chrome.experimental.infobars.show({ 'htmlPath': url }, callback);
    }
    else
    {
        console.log('infoBar not supported');
        return;
    }

}

Utils.Chrome.clipBoard = {};
Utils.Chrome.clipBoard.copy = function()
{
    Utils.Chrome.tabs.getCurrent(function(tab){
        chrome.experimental.clipboard.executeCopy(tab.id);
    });
}

Utils.Chrome.tabs = {};
Utils.Chrome.tabs.getCurrent = function(callback)
{
    chrome.windows.getAll({}, function(w){
        chrome.tabs.getSelected(w[0].id, callback);
    });
}

Utils.Chrome.browserAction = {};
Utils.Chrome.browserAction.text = function(txt)
{
    chrome.browserAction.setBadgeText({text:''+ (txt?txt:'') });
}

Utils.Chrome.browserAction.title = function(tit)
{
    chrome.browserAction.setTitle({title: (tit?tit:'') });
}

Utils.Chrome.browserAction.color = function(cor)
{
    chrome.browserAction.setBadgeBackgroundColor({color: (cor?cor:[255, 255, 255, 255]) });
}